package delay;

import cn.hutool.core.util.RandomUtil;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

/**
 * 延迟消费-生产者
 *
 * @author Administrator
 * @date 2022/04/01 10:39
 **/
public class DelayProducer {
    public static void main(String[] args) throws Exception {
//        DefaultMQProducer producer = new DefaultMQProducer("Delay-Producer");
//        producer.setNamesrvAddr("rocketmq1.cn:9876;rocketmq2.cn:9876");
//
//        producer.start();
//
//        for (int i = 0; i < 1000; i++) {
//            Message message = new Message("Delay-Msg", "order", RandomUtil.randomString(100).getBytes(StandardCharsets.UTF_8));
//            /**
//             * // org/apache/rocketmq/store/config/MessageStoreConfig.java
//             * private String messageDelayLevel = "1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h";
//             */
//            message.setDelayTimeLevel(3);
//
//            producer.send(message);
//        }
//
//        producer.shutdown();
        for (int i = 0; i < 13; i++) {
            long l = RandomUtil.randomLong(1000000000L, 9999999999L);
            System.out.println(l);
        }



    }
}
